package com.动态加载.constat;


import lombok.Getter;

import java.util.HashMap;
import java.util.Map;
@Getter
public enum GirlEnum {
    BIGGIRL(1,SupperGirlEnum.BIGGIRL,"大女人"),
    SMALLGIRL(2,SupperGirlEnum.SMALLGIRL,"小女人"),
    SHAO(4,SupperGirlEnum.SHAO,"骚女人"),
    YOUNGGIRL(3,SupperGirlEnum.YOUNGGIRL,"年轻女人");

    int value;
    String type;
    SupperGirlEnum supperGirlEnum;
     GirlEnum(int value,SupperGirlEnum supperGirlEnum,String type){
        this.supperGirlEnum = supperGirlEnum;
        this.value = value;
        this.type = type;
        Cache.valueMapping.put(value,this);
        Cache.mapping.put(supperGirlEnum,this);

    }
    int getValue(){
        return this.value;
    }
    String getType(){
        return this.type;
    }
    public static String getType(Integer girlType){
        return Cache.valueMapping.get(girlType).getType();
    }
    /**
     * 数字类型获取女人
     * @param girlValue
     * @return
     */
    public static GirlEnum getGirlType(Integer girlValue){
        return Cache.valueMapping.get(girlValue);
}

    /**
     * 超级女人
     * @param supperGirlEnum
     * @return
     */
    public static GirlEnum getSupperGirl(SupperGirlEnum supperGirlEnum){
        return Cache.mapping.get(supperGirlEnum);
}
public static class Cache{

        public static Map<Integer,GirlEnum> valueMapping = new HashMap<>();
        public static Map<SupperGirlEnum,GirlEnum> mapping = new HashMap<>();
}
    public static void main(String[] args) {
        GirlEnum girl = GirlEnum.BIGGIRL;

        for(GirlEnum girlEnum: GirlEnum.values()){
            System.out.println(girlEnum);
            System.out.println(girlEnum.getValue()+" "+girlEnum.getType());
        }
    }

}